package com.x.erp.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.alibaba.dubbo.config.annotation.Service;
import com.x.erp.dao.StockAgeDao;
import com.x.erp.manage.StockAgeManage;
import com.x.erp.model.StockAge;
import com.x.erp.rpc.StockAgeRpcService;
import com.x.framework.exception.BusinessException;
import com.x.framework.exception.ExceptionCode;
import com.x.framework.service.BaseService;

/**
 * 库龄服务
 */
@Component
@Service(interfaceName = "com.x.erp.rpc.StockAgeRpcService", timeout = 60000)
public class StockAgeService extends BaseService implements StockAgeRpcService {

	@Autowired
	private StockAgeDao stockAgeDao;// 库龄信息DAO

	@Autowired
	private StockAgeManage stockAgeManage;// 库龄信息Manage

	/**
	 * 查询库龄列表
	 * 
	 * @param stockAge
	 * @return
	 */
	@Override
	public List<StockAge> selectStockAgeList(StockAge stockAge) {
		try {
			return stockAgeDao.selectStockAgeList(stockAge);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

	/**
	 * 新增库龄信息
	 * 
	 * @param stockAge
	 * @return
	 */
	@Override
	public StockAge insertStockAge(StockAge stockAge) {
		try {
			return this.insert(stockAge);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

	/**
	 * 修改库龄信息
	 * 
	 * @param stockAge
	 * @return
	 */
	@Override
	public int updateStockAge(StockAge stockAge) {
		try {
			return this.updateStockAge(stockAge);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

	/**
	 * 修改库龄信息任务
	 * 
	 * @param stockAge
	 * @return
	 */
	@Override
	public int updateStockAgeTask(StockAge stockAge) {
		try {
			return stockAgeManage.updateStockAgeTask(stockAge);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

}
